!function() {
	
	// 获得基础JIPIN对象
	var JIPIN = window.__NS__JIPIN;
	if(!JIPIN) { return; }
	var $ = JIPIN.$;
	
	JIPIN._fixImage = JIPIN.fixImage;
	JIPIN._refixImage = JIPIN.refixImage;
	
	JIPIN.getSourceURL = function(targetPic) {
		var url = document.location.href;
		if(isWaterfallPic(targetPic)) {
			url = targetPic.parent().get(0).href; 
		}
		return url;
	};
	
	JIPIN.fixImage = function(image, callback) {
		if(isWaterfallPic(image)) {
			callback(image);
		} else {
			this._fixImage(image, callback);
		}
	};
	
	JIPIN.refixImage = function(image, callback) {
		if(isWaterfallPic(image)) {
			callback(image);
		} else {
			this._refixImage(image, callback);
		}
	};
	
	function isWaterfallPic(pic) {
		return $(pic).parent().parent().is('div.goods_pic');
	}
	
}();